package com.ibeeking.found.common.enums.msg;

/**
 * @Author ibeeking
 * @Description: 消息接收方类型
 */
public enum MsgReceiverTypeEnum {
    BUYER("买家消息", 1),
    SELLER("卖家消息", 2),
    PLATFORM("平台消息", 3),
    ;

    private String name;
    private Integer code;

    MsgReceiverTypeEnum(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public Integer getCode() {
        return code;
    }

    public static String getNameByCode(Integer code) {
        for (MsgReceiverTypeEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj.getName();
            }
        }
        return null;
    }

    public static MsgReceiverTypeEnum getEnumByCode(Integer code) {
        for (MsgReceiverTypeEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj;
            }
        }
        return null;
    }
}
